package com.itheima.springboot4;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import redis.clients.jedis.Jedis;

@SpringBootApplication
public class Springboot4Application {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(Springboot4Application.class, args);
        Jedis bean = context.getBean(Jedis.class);
        System.out.println(bean);
        bean.set("name", "zzhangsan");
        String name = bean.get("name");
        System.out.println(name);
    }
        @Bean
        public Jedis jedis(){
            return new Jedis("localhost",6379);
        }

}
